/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ComExWeb.dominio;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 *
 * @author 
 */
@Entity
@Table(schema = "desenv", name = "ITEM_COMPRA")
@NamedQueries({
    @NamedQuery(name = "ItemCompra.findAll", query = "SELECT c FROM ItemCompra c")})
public class ItemCompra implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID_Compra")
    //@GeneratedValue(generator = "seq")
    //@SequenceGenerator(name = "seq", sequenceName = "SEQ1", allocationSize = 1)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long idItemCompra;

    @Column(name = "DESCRICAO")
    private String descricao;

    @JoinColumn(name = "COMPRA", referencedColumnName = "ID_Compra")
    @ManyToOne(optional = false)
    private Compra compra;

    @JoinColumn(name = "OFERTA", referencedColumnName = "ID_OFERTA")
    @ManyToOne(optional = false)
    private Oferta oferta;


    public ItemCompra() {
    }

    public Compra getCompra() {
        return compra;
    }

    public void setCompra(Compra compra) {
        this.compra = compra;
    }

    public Oferta getOferta() {
        return oferta;
    }

    public void setOferta(Oferta oferta) {
        this.oferta = oferta;
    }

    
 
    private static final Logger log = LoggerFactory.getLogger(ItemCompra.class);

    public void setIdItemCompra(Long idItemCompra) {

        this.idItemCompra = idItemCompra;
    }

    public String getDescricao() {
        return descricao;
    }

    public void setDescricao(String descricao) {
        this.descricao = descricao;
    }



    
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idItemCompra != null ? idItemCompra.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ItemCompra)) {
            return false;
        }
        ItemCompra other = (ItemCompra) object;
        if ((this.idItemCompra == null && other.idItemCompra != null) || (this.idItemCompra != null && !this.idItemCompra.equals(other.idItemCompra))) {
            return false;
        }
        return true;
    }
}
